/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function replaceQueryString(url,param,value) {
    var re = new RegExp("([?|&])" + param + "=.*?(&|$)","i");
    if (url.match(re))
        return url.replace(re,'$1' + param + "=" + value + '$2');
    else
        return url + '?' + param + "=" + value;
}

function addCommas(nStr)
{
        var delim = '.';
        nStr += '';
        x = nStr.split('.');
        x1 = x[0];
        x2 = x.length > 1 ? '.' + x[1] : '';
        var rgx = /(\d+)(\d{3})/;
        while (rgx.test(x1)) {
                x1 = x1.replace(rgx, '$1' + delim + '$2');
        }
        return x1 + x2;
}

function stripNonNumeric( str )
{
        str += '';
        var rgx = /^\d|\,|-$/;
        var out = '';
        for( var i = 0; i < str.length; i++ )
        {
            if( rgx.test( str.charAt(i) ) ){
                if( !( ( str.charAt(i) == '.' && out.indexOf( '.' ) != -1 ) ||
                ( str.charAt(i) == '-' && out.length != 0 ) ) ){
                    out += str.charAt(i);
                }
            }
        }
        return out;
}

function replaceTitik(str){
        out = str.replace(".", "");
        return out;
}